package com.codefish.codefishseckill.sentinel;

import com.codefish.codefishseckill.entity.User;

import javax.servlet.http.HttpServletRequest;

/**
 * API访问限流服务类
 *
 * @author codefish
 * @version 1.0
 * @date 2022/08/04 上午 10:33
 */
public interface CurrentLimitAccessService {

    String TOKEN_REDIS_PREFIX = "currentLimit:";
    String TIMESTAMP_REDIS_PREFIX = "currentLimitTimestamp:";

    /**
     * 判断登录的用户是否可以访问这个API
     *
     * @param request 请求
     * @param user    用户信息
     * @return 是否可访问
     */
    boolean canAccessURI(HttpServletRequest request, User user);

}
